﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Content/Master.Master" Inherits="System.Web.Mvc.ViewPage<SCS.Core.Models.Collection.UserCollection>" %>
<%@ Import Namespace="SCS.Core" %>
<%@ Import Namespace="SCS.Core.Models" %>
<%@ Import Namespace="SCS.Core.ViewModels" %>
<%@ Import Namespace="SCS.Core.Controllers" %>
<%@ Import Namespace="SCSService" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Người dùng
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <script type="text/javascript" src="/ThemeExtends/AdminSkin/js/jquery.flot.js"></script>
    <script type="text/javascript" src="/ThemeExtends/AdminSkin/js/jquery.flot.stack.js"></script>	
    <link rel="stylesheet" type="text/css" href="/Content/smoothness-1.8.13/jquery-ui-1.8.13.custom.css"/>
    <link rel="stylesheet" type="text/css" href="/Content/smoothness-1.8.13/ui.dropdownchecklist.themeroller.css"/>
    <script type="text/javascript" src="/Scripts/jquery-1.6.1.min.js"></script>
    <script type="text/javascript" src="/Scripts/jquery-ui-1.8.13.custom.min.js"></script>
    <script type="text/javascript" src="/Scripts/ui.dropdownchecklist-1.4-min.js"></script>
    <script type="text/javascript" src="/Scripts/ui.dropdownchecklist.js"></script>
    <%--Validator--%>
    <script src="/Scripts/jquery.validate.min.js" type="text/javascript"></script>
    <script src="/Scripts/MicrosoftMvcJQueryValidation.js" type="text/javascript"></script>
    <% Html.EnableClientValidation(); %>
    <% using (Html.BeginForm((bool)ViewData["IsAdd"] ? "SaveAddUser" : "SaveEditUser", "User", FormMethod.Post, new { id = "sendFileForm", enctype = "multipart/form-data" }))
            {%> 

    <div class="clear"></div>
       
        <div class="box ">
		    <h2 class="box-header"><%=(bool)ViewData["IsAdd"] ? "Tạo mới người dùng" : "Cập nhật người dùng" %></h2>
		    <div class="box-content">

                <table>
                    
                    <% if ((bool)ViewData["IsAdd"] == false)
                       {
                        %>
                            <%--<tr>
                                <td>
                                    <label class="form-label"> Tên tài khoản </label>
                                </td>
                                <td>
                                    <%= Html.TextBoxFor(m => m.UserName, new { @class = "form-field small" })%> <span style="color:Red;font-weight:bold"><%= Html.ValidationMessageFor(m => m.UserName)%></span>
                                </td>
                            </tr>--%>
                            <tr>
                                <td>
                                    <label class="form-label"> Email </label>
                                </td>
                                <td>
                                    <%= Html.TextBoxFor(m => m.Email, new { @class = "form-field half" })%><span style="color:Red;font-weight:bold"><%= Html.ValidationMessageFor(m => m.Email)%></span>
                                </td>
                            </tr>
                            
                            <tr>
                                <td>
                                    <label class="form-label">Quyền</label>
                                </td>
                                <td>
                                    <%= Html.DropDownList("RoleID", (SelectList)ViewData["ListUserRoleDrop"])%> 
                                </td>
                            </tr>
                             <tr>
                                <td><label class="form-label">Trạng thái </label></td>
                                <td>
                                    <%
                                        List<SelectListItem> statusChoose = new List<SelectListItem>();
                                        statusChoose.AddRange(new SelectListItem[] { 
                                        new SelectListItem{ Text = "Kích hoạt", Value = "1" },
                                        new SelectListItem{ Text = "Không kích hoạt", Value = "0" }
                                    });
                                    %>

                                    <%=Html.DropDownListFor(m => m.UserStatus, statusChoose)%>
                                </td>
                            </tr>
                          <%=Html.HiddenFor(m => m.Password)%>     
                        <%
                        
                       }
                       else
                       { 
                        %>
                            <%--<tr>
                                <td>
                                    <label class="form-label"> Tên tài khoản</label>
                                </td>
                                <td>
                                    <%= Html.TextBoxFor(m => m.UserName, new { @class = "form-field small" })%> <span style="color:Red;font-weight:bold"><%= Html.ValidationMessageFor(m => m.UserName)%></span>
                                </td>
                            </tr>--%>
                            <tr>
                                <td>
                                    <label class="form-label"> Email </label>
                                </td>
                                <td>
                                    <%= Html.TextBoxFor(m => m.Email, new { @class = "form-field half" })%><span style="color:Red;font-weight:bold"><%= Html.ValidationMessageFor(m => m.Email)%></span>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <label class="form-label">Mật khẩu </label>
                                </td>
                                <td>
                                    <%= Html.TextBoxFor(m => m.Password, new { @class = "form-field small" })%>(Password default:123456)
                                </td>
                            </tr>
                            <%--<tr>
                                <td>Status</td>
                                <td>
                                    <%
                                        List<SelectListItem> statusChoose = new List<SelectListItem>();
                                        statusChoose.AddRange(new SelectListItem[] { 
                                        new SelectListItem{ Text = "Active", Value = "1" },
                                        new SelectListItem{ Text = "unactive", Value = "0" }
                                    });
                                    %>

                                    <%=Html.DropDownListFor(m => m.UserStatus, statusChoose)%>
                                </td>
                            </tr>--%>
                            <tr>
                                <td>
                                    <label class="form-label">Quyền</label>
                                </td>
                                <td>
                                    <%= Html.DropDownList("RoleID", (SelectList)ViewData["ListUserRoleDrop"])%> 
                                </td>
                            </tr>	
                        <%
                       }  
                    %>  
                    
                    
                    
                </table>
                
                                            
                <%=Html.HiddenFor(m => m.UserID)%>
                <%=Html.HiddenFor(m=>m.UserName) %>            
                <p>
                <%=ViewData["Result"]%>
                </p>
                                   
                <input type="submit" value="" class="button white_input save_input " style="width: 74px;height: 28px; float:left; margin-right:10px;"/> <!--Button Save-->
                <a class="button white" href="javascript:history.back();"><span class="icon_text cancel"></span>Đóng</a> <!--Button Close-->
                
	        </div>
	    </div>
        
    <% } %>


</asp:Content>
